//
//  KFDAsyncTestUtil.m
//  KFD
//
//  Created by JIRENTIANXIANG on 6/6/15.
//  Copyright (c) 2015 KFD. All rights reserved.
//

#import "KFDAsyncTestUtil.h"

@implementation KFDAsyncTestUtil

+ (BOOL)waitFor:(BOOL *)flag timeout:(NSTimeInterval)timeoutSecs {
    NSDate *timeoutDate = [NSDate dateWithTimeIntervalSinceNow:timeoutSecs];
    
    do {
        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:timeoutDate];
        if ([timeoutDate timeIntervalSinceNow] < 0.0) {
            break;
        }
    }
    while (!*flag);
    return *flag;
}

@end
